package control;

import java.util.ArrayList;

import debug.Console;

import types.*;


public class Syntatic {
	private ArrayList<WordInfo> tokens;
	
	private Sentence sentence;
	
	private int lastWordChecked = 0;
	
	public Syntatic(ArrayList<WordInfo> tokens) {
		this.tokens = tokens;
		sentence = new Sentence();
	}
	
	public Sentence getSentence() {
		return sentence;
	}
	
	public void setTokens(ArrayList<WordInfo> _tokens) {
		tokens = _tokens;
	}
	
	private String returnStringWord(int index, String type) {
		return this.tokens.get(index).getWord() + " (" + type + ")";
	}
	
	public boolean checkSentence() throws Exception {
		int index = 0;
		
		if (checkStart_Sub(index)) {
			Console.addInfoLine("> checkStart_Sub success");
			return true;
		}
		
		if (checkStart_Adj(index)) {
			Console.addInfoLine("> checkStart_Adj success");
			return true;
		}
		
		if (checkStart_Artigo(index)) {
			Console.addInfoLine("> checkStart_Artigo success");
			return true;
		}
		
		if (checkStart_Pronom(index)) {
			Console.addInfoLine("> checkStart_Pronom success");
			return true;
		}
		
		throw new Exception("You seems to have a problem near the word " + (this.lastWordChecked + 1) + " : " + this.tokens.get(lastWordChecked).getWord());
		
	}
	
	private boolean checkType(int index, String type) {
		if (this.tokens.size() > index) {
			WordInfo w = this.tokens.get(index);
			if (w != null) {
				if (index > lastWordChecked) {
					lastWordChecked = index;
				}
				return w.hasThisType(type);
			}
		}
		return false;
	}
	
	private boolean checkStart_Pronom(int index) {
		if (checkType(index, Type.PRONOME)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.PRONOME) + " checkStart_Pronom");
			if (checkSujeitoConj(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.PRONOME)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PRONOME) + " checkStart_Pronom : checkSujeitoConj success");
				return true;
			}
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.PRONOME)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PRONOME) + " checkStart_Pronom : checkVerb success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkStart_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Sub");
			if (checkPontoFinal(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				sentence.setFrase_simple(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Sub : checkPontoFinal success");
				return true;
			}
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Sub : checkVerb success");
				return true;
			}
			
			if (checkStart_Sub_Adj(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Sub : checkStart_Sub_Adj success");
				return true;
			}
			
			if (checkSujeitoConj(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Sub : checkSujeitoConj success");
				return true;
			}
		}
		
		return false;
	}
	
	private boolean checkStart_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Adj");
			if (checkPontoFinal(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(null, this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				sentence.setFrase_simple(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Adj : checkPontoFinal success");
				return true;
			}

			if (checkStart_Adj_Sub(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Adj : checkStart_Adj_Sub success");
				return true;
			}
		}

		return false;
	}
	
	private boolean checkStart_Artigo(int index) {
		if (checkType(index, Type.ARTIGO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkStart_Artigo");
			if (checkStart_Sub(index + 1)) {
				sentence.getSujeito().getLeft().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkStart_Artigo : checkStart_Sub success");
				return true;
			}

			if (checkStart_Adj(index + 1)) {
				sentence.getSujeito().getLeft().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkStart_Artigo : checkStart_Adj success");
				return true;
			}
		}
		return false;
	}
	

	private boolean checkPontoFinal(int index) {
		if (checkType(index, Type.PONTUACAO_FINAL)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.PONTUACAO_FINAL) + " checkPontoFinal");
			return true;
		}
		return false;
	}
	
	private boolean checkStart_Sub_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Sub_Adj");
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Sub_Adj : checkVerb success");
				return true;
			}

			if (checkSujeitoConj(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkStart_Sub_Adj : checkSujeitoConj success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkStart_Adj_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Adj_Sub");
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Adj_Sub : checkVerb success");
				return true;
			}

			if (checkSujeitoConj(index + 1)) {
				sentence.getSujeito().setLeft(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkStart_Adj_Sub : checkSujeitoConj success");
				return true;
			}
		}
		return false;
	}
	
	
	
	private boolean checkSujeitoConj(int index) {
		if (checkType(index, Type.CONJUNCAO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.CONJUNCAO) + " checkSujeitoConj");
			if (checkConj_Sub(index + 1)) {
				sentence.getSujeito().setConf(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.CONJUNCAO) + " checkSujeitoConj : checkConj_Sub success");
				return true;
			}
			if (checkConj_Adj(index + 1)) {
				sentence.getSujeito().setConf(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.CONJUNCAO) + " checkSujeitoConj : checkConj_Adj success");
				return true;
			}
			if (checkConj_Art(index + 1)) {
				sentence.getSujeito().setConf(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.CONJUNCAO) + " checkSujeitoConj : checkConj_Art success");
				return true;
			}
			if (checkConj_Pron(index + 1)) {
				sentence.getSujeito().setConf(true);
				Console.addInfoLine(index + " " + returnStringWord(index, Type.CONJUNCAO) + " checkSujeitoConj : checkConj_Pron success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkConj_Sub");
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setRight(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkConj_Sub : checkVerb success");
				return true;
			}
			
			if (checkConj_Sub_Adj(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkConj_Sub : checkConj_Sub_Adj success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkConj_Adj");
			
			/*if (checkVerb(index + 1)) {
				sentence.getSujeito().setRight(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkConj_Adj : checkVerb success");
				return true;
			}*/
			
			if (checkConj_Adj_Sub(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkConj_Adj : checkConj_Adj_Sub success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Art(int index) {
		if (checkType(index, Type.ARTIGO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkConj_Art");
			
			if (checkConj_Adj(index + 1)) {
				sentence.getSujeito().getRight().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkConj_Art : checkConj_Adj success");
				return true;
			}
			
			if (checkConj_Sub(index + 1)) {
				sentence.getSujeito().getRight().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkConj_Art : checkConj_Sub success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Sub_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkConj_Sub_Adj");
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setRight(new SujetoSimple(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkConj_Sub_Adj : checkVerb success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Adj_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkConj_Adj_Sub");
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setRight(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkConj_Adj_Sub : checkVerb success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkConj_Pron(int index) {
		if (checkType(index, Type.PRONOME)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.PRONOME) + " checkConj_Pron");
			
			if (checkVerb(index + 1)) {
				sentence.getSujeito().setRight(new SujetoSimple(this.tokens.get(index).getFilteredObject(Type.PRONOME)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PRONOME) + " checkConj_Pron : checkVerb success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb(int index) {
		if (checkType(index, Type.VERB)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb");
			
			if (checkPontoFinal(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkPontoFinal success");
				return true;
			}
			if (checkVerb_Adv(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkVerb_Adv success");
				return true;
			}
			if (checkVerb_Adj(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkVerb_Adj success");
				return true;
			}
			if (checkVerb_Prep(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkVerb_Prep success");
				return true;
			}
			if (checkVerb_Art(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkVerb_Art success");
				return true;
			}
			if (checkVerb_Sub(index + 1)) {
				sentence.setVerb(this.tokens.get(index).getFilteredObject(Type.VERB));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.VERB) + " checkVerb : checkVerb_Sub success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Art(int index) {
		if (checkType(index, Type.ARTIGO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Art");
			
			if (checkVerb_Sub(index + 1)) {
				sentence.getCompl().getSub().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Art : checkVerb_Sub success");
				return true;
			}
			if (checkVerb_Art_Adj(index + 1)) {
				sentence.getCompl().getSub().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Art : checkVerb_Adj success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Sub");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Sub : checkVerb_Prep success");
				return true;
			}
			if (checkVerb_Sub_Adj(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Sub : checkVerb_Sub_Adj success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Sub : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Sub_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Sub_Adj");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Sub_Adj : checkVerb_Prep success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Sub_Adj : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Art_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Art_Adj");
			
			if (checkVerb_Art_Adj_Sub(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Art_Adj : checkVerb_Art_Adj_Sub success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Art_Adj_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Art_Adj_Sub");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Art_Adj_Sub : checkVerb_Prep success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Art_Adj_Sub : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Adv(int index) {
		if (checkType(index, Type.ADVERBIO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADVERBIO) + " checkVerb_Adv");
			
			if (checkVerb_Adj(index + 1)) {
				sentence.getCompl().setAdv(this.tokens.get(index).getFilteredObject(Type.ADVERBIO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADVERBIO) + " checkVerb_Adv : checkVerb_Adj success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().setAdv(this.tokens.get(index).getFilteredObject(Type.ADVERBIO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADVERBIO) + " checkVerb_Adv : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Adj");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(null, this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Adj : checkVerb_Prep success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().setSub(new SubstantivoSimple(null, this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Adj : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep(int index) {
		if (checkType(index, Type.PREPOSITION)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.PREPOSITION) + " checkVerb_Prep");
			
			if (checkVerb_Prep_Art(index + 1)) {
				sentence.getCompl().getComplaux().get(sentence.getCompl().getComplaux().size() - 1).setPrep(this.tokens.get(index).getFilteredObject(Type.PREPOSITION));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PREPOSITION) + " checkVerb_Prep : checkVerb_Prep_Art success");
				return true;
			}
			if (checkVerb_Prep_Sub(index + 1)) {
				sentence.getCompl().getComplaux().get(sentence.getCompl().getComplaux().size() - 1).setPrep(this.tokens.get(index).getFilteredObject(Type.PREPOSITION));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PREPOSITION) + " checkVerb_Prep : checkVerb_Prep_Sub success");
				return true;
			}
			if (checkVerb_Prep_Adj(index + 1)) {
				sentence.getCompl().getComplaux().get(sentence.getCompl().getComplaux().size() - 1).setPrep(this.tokens.get(index).getFilteredObject(Type.PREPOSITION));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.PREPOSITION) + " checkVerb_Prep : checkVerb_Prep_Adj success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep_Art(int index) {
		if (checkType(index, Type.ARTIGO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Prep_Art");
			
			if (checkVerb_Prep_Sub(index + 1)) {
				sentence.getCompl().getComplaux().get(sentence.getCompl().getComplaux().size() - 1).getSub().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Prep_Art : checkVerb_Prep_Sub success");
				return true;
			}
			if (checkVerb_Prep_Adj(index + 1)) {
				sentence.getCompl().getComplaux().get(sentence.getCompl().getComplaux().size() - 1).getSub().setArt(this.tokens.get(index).getFilteredObject(Type.ARTIGO));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ARTIGO) + " checkVerb_Prep_Art : checkVerb_Prep_Adj success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Sub");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Sub_Adj : checkVerb_Prep success");
				return true;
			}
			if (checkVerb_Prep_Sub_Adj(index + 1)) {
				// Nothing on objects
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Sub : checkVerb_Prep_Sub_Adj success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index).getFilteredObject(Type.NOUN), null));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Sub : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Adj");
			
			if (checkVerb_Prep_Adj_Sub(index + 1)) {
				// Nothing on objets
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Adj : checkVerb_Prep_Adj_Sub success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep_Sub_Adj(int index) {
		if (checkType(index, Type.ADJECTIVO)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Sub_Adj");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Sub_Adj : checkVerb_Prep success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index - 1).getFilteredObject(Type.NOUN), this.tokens.get(index).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.ADJECTIVO) + " checkVerb_Prep_Sub_Adj : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
	
	private boolean checkVerb_Prep_Adj_Sub(int index) {
		if (checkType(index, Type.NOUN)) {
			Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Adj_Sub");
			
			if (checkVerb_Prep(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Adj_Sub : checkVerb_Prep success");
				return true;
			}
			if (checkPontoFinal(index + 1)) {
				sentence.getCompl().addComplementoAux(new ComplementoAux(this.tokens.get(index).getFilteredObject(Type.NOUN), this.tokens.get(index - 1).getFilteredObject(Type.ADJECTIVO)));
				Console.addInfoLine(index + " " + returnStringWord(index, Type.NOUN) + " checkVerb_Prep_Adj_Sub : checkPontoFinal success");
				return true;
			}
		}
		return false;
	}
}
